<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:include="include/head1">

</head>
<body>
<div class="page">
	<div class="head">
		<div class="head_left">
<!--			<img th:src="${basePath}+'/dist/img/icon.png'" class="icon"/>-->
			<div class="head_title">
				<label class="head_top_title">校友会系统后台</label>
				<label class="head_top_title_sm">
					Full asset security  management system</label>
			</div>
		</div>
		<div class="head_right">
			<img th:src="${basePath}+'/dist/img/user.png'" class="user"/>
			<div class="head_user">
				<label class="user_name" th:text="${userBean.username}">王先生</label>
			</div>
			<form th:action="@{/logout}" method="post" id="loginOut">
				<div class="head_function">
					<img th:src="${basePath}+'/dist/img/head_function.png'" class="function"/>
					<label class="function_text">注销</label>
				</div>
			</form>
		</div>
	</div>
	<div class="body" id="body">
		<div class="nav_base">
			<div class="nav_f nav_f_selected">
				<div class="inner">
					<div class="inner_left" data-size="0" data-level="1" data-url="../p_recruitment/welcome">
						<img th:src="${basePath}+'/dist/img/icon_index_selected.png'" class="icon_tip"/>
						<label class="normal_selected">首页</label>
					</div>
				</div>
			</div>
			<div class="nav_f" th:each="menu,menuState : ${menuVo.list}">
				<div class="inner">
					<div class="inner_left" th:url="${#httpServletRequest.contextPath}+${menu.url}" th:data-size="${#lists.isEmpty(menu.list)}?0:${#lists.size(menu.list)}" data-level="1" th:data-id="${menu.id}" data-show="0">
						<img th:src="${basePath}+'/dist/img/icon_'+${menu.legend}+'.png'" class="icon_tip"/>
						<label class="normal" th:text="${menu.name}">政策通知</label>
					</div>
					<img th:src="${basePath}+'/dist/img/icon_right.png'" class="icon_ceng"/>
				</div>
				<div th:class="'nav_s menu_s_'+${menu.id}" th:each="menu2 : ${menu.list}" style="display:none;">
					<div class="inner_end" th:url="${#httpServletRequest.contextPath}+${menu2.url}" th:data-size="${#lists.isEmpty(menu2.list)}?0:${#lists.size(menu2.list)}" data-level="2">
						<label class="normal" th:text="${menu2.name}">政策文件</label>
					</div>
				</div>
			</div>
		</div>
		<div class="view_base">
			<iframe th:src="${#httpServletRequest.contextPath}+'/welcome'" style="border: 0; width: 100%;" id="iframe"></iframe>
		</div>
	</div>
</div>
	<!-- ./wrapper -->
	<div th:include="include/foot"></div>

	<script  th:inline="javascript">
	function   suec(mess){
    	layer.msg(mess, {icon: 1})
	}
		let p=0;
		let d=false;
		$().ready(function() {
			$("#iframe").attr('height', ($(document).height() - 120) + 'px');
			$("#iframe").on('load',function(){
				d=true;
				$(".progress-bar").css('width','100%');
				$(".pro").hide();
			});
			$(".head_function").click(function(){
				$("#loginOut").submit();
			});
			$(".inner_end").click(function(e) {
				let that=$(this);
				let url = that.attr('url');

					p=0;
					d=false;
					$(".progress-bar").css('width','0%');
					$(".pro").show();
					pro();
					$("#iframe").attr('src', url);
					cleanActive();
					setActive(that);
			});
			$(".inner").click(function(e){
				let that=$(this).children('.inner_left');
				let size= that.data('size');
				if(size==0){
					cleanActive();
					that.parent().parent().addClass('nav_f_selected');
					that.parent().find('.normal').addClass('normal_selected').removeClass('normal');
					let img= that.parent().find('.icon_tip');
					img[0].src=img[0].src.replace(/.png/,'_selected.png');
					let url=that.data('url');
					$("#iframe").attr('src', url);
					return;
				}
				let show=that.data('show');
				let id=that.data('id');
				if(show==0){
					$(".menu_s_"+id).show();
					let img=that.parent().find('.icon_ceng');
					img[0].src=img[0].src.replace(/_right.png/,'_down.png');
					that.data('show',1);
				}else{
					$(".menu_s_"+id).hide();
					let img=that.parent().find('.icon_ceng');
					img[0].src=img[0].src.replace(/_down.png/,'_right.png');
					that.data('show',0);
				}
			});
			$("#editpass").click(function(e) {
				 layer.open({
				        type: 2, 
				        closeBtn:0,
				        title: false, 
				        area: ['400px', '370px'],
				        content: [[${#httpServletRequest.contextPath}]]+'/systUser/edit',
				      });
			});
			cleanActive=function(){
				$(".inner_end").each(function(i,e){
					$(e).removeClass('inner_end_selected');
					$(e).children('.normal').removeClass('normal_selected');
				});
				$(".nav_f").each(function(i,e){
					$(e).removeClass('nav_f_selected');
					$(e).find('.normal_selected').addClass('normal').removeClass('normal_selected');
					let img1=$(e).find('.icon_tip');
					if(img1!=undefined&&img1.length>0){
						img1[0].src=img1[0].src.replace(/_selected.png/,'.png');
					}
				});
			},
			setActive=function(e){
				if(e.data('level')==1){
					e.parent().parent().prev().addClass('active');
					e.parent().parent().parent().parent().prev().addClass('active');
				}else if(e.data('level')==2){
					e.addClass('inner_end_selected');
					e.children('.normal').addClass('normal_selected');
					e.parent().parent().addClass('nav_f_selected');
					e.parent().parent().find('.inner_left').find('.normal').addClass('normal_selected').removeClass('normal');
					let img1=e.parent().parent().find('.inner_left').find('.icon_tip');
					img1[0].src=img1[0].src.replace(/.png/,'_selected.png');
				}
			}
		});
		pro=function(){
				p=p+10;
				
				$(".progress-bar").css('width',p+'%');
				if(p<100&&!d){
					setTimeout(function(){
						this.pro();
					},10);
				}
			}
		loadPage=function(){
			console.log('loadPage');
			p=0;
			d=false;
			$(".progress-bar").css('width','0%');
			$(".pro").show();
			pro();
		}
	</script>

</body>
</html>
